﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using System.Data;
using KPIS.Utils;
using KPIS.DBM;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.MODEL;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class PR_BudgetManagementTest : System.Web.UI.UserControl
    {
        private SsMng ssMng = new SsMng();
        private object _dataItem = null;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected bool IsUserControlPostBack
        {
            get
            {
                return this.ViewState["IsUserControlPostBack"] != null;
            }
        }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            if (DataItem != null)
            {
                //   cbGender.ListGenderComboBox();
                if (!(DataItem is Telerik.Web.UI.GridInsertionObject))
                {
                    rdoComfirm.SelectedValue = DataBinder.Eval(DataItem, "confirm").ToString();
                    this.ViewState.Add("IsUserControlPostBack", true);
                }
                else
                {

                }
            }
        }

        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }

        protected void btnAddnew_Click(object sender, EventArgs e)
        {
            BudgetManagementTestBLL obj = new BudgetManagementTestBLL();
            int PrmSeq = (int)Session["PrmSeq"];
            int JobSiteSeq = (int)Session["JobSiteSeq"];
            obj.Insert(obj.GetManageSeq(JobSiteSeq, PrmSeq) 
                , txtName.Text.Trim()
                , txtRemarks.Text.Trim()
                , Int32.Parse(rdoComfirm.SelectedValue)
                , ssMng.EmpSeqI);
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            BudgetManagementTestBLL obj = new BudgetManagementTestBLL();
            obj.Update(Int32.Parse(lblSequence.Text)
                , txtName.Text.Trim()
                , txtRemarks.Text.Trim()
                , Int32.Parse(rdoComfirm.SelectedValue)
                , ssMng.EmpSeqI);
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }
    }
}